/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful ,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not , write to the Free Software
 * Foundation , Inc., 59 Temple Place - Suite 330, Boston , MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */

package l1j.william;

import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.serverpackets.S_SkillSound;

public class SustainEffect extends TimerTask {
	private static Logger _log = Logger
			.getLogger(SustainEffect.class.getName());

	private final L1PcInstance Active_pc;
	private final int effect_id;

	public SustainEffect(final L1PcInstance pc, final int effect) {
		this.Active_pc = pc;
		this.effect_id = effect;
	}

	@Override
	public void run() {
		try {
			if (this.Active_pc.isDead()) {
				return;
			}
			this.Active_pc.sendPackets(new S_SkillSound(this.Active_pc.getId(),
					this.effect_id));
			this.Active_pc.broadcastPacketAll(new S_SkillSound(this.Active_pc
					.getId(), this.effect_id));
		} catch (final Throwable e) {
			_log.log(Level.WARNING, e.getLocalizedMessage(), e);
		}
	}
}
